package my.sample.ha.cluster;

import org.jgroups.JChannel;
import org.jgroups.Message;
import org.jgroups.ReceiverAdapter;

public class JGroupFirst {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		try {
			JChannel channel=new JChannel("/home/murali/workspace/JGroups/conf/udp.xml");
			  channel.setReceiver(new ReceiverAdapter() {
			      public void receive(Message msg) {
			          System.out.println("received msg from " + msg.getSrc() + ": " + msg.getObject());
			      }
			  });
			  channel.connect("MyCluster");
/*			  if ( args[0].equalsIgnoreCase("master"))
                  channel.send(new Message(null, "hello world"));
			  Thread.sleep(4000);*/
			  channel.close();
		} catch (Exception e) {
			e.printStackTrace();
		}


	}

}
